package tjs.study.mini.spring.web;

import tjs.study.mini.spring.AbstractBeanDefinition;
import tjs.study.mini.spring.register.BeanDefinitionRegistry;
import tjs.study.mini.spring.register.ConfigurationClassPostProcessor;

/**
 * Created by Nicky.Tang on 2021/9/13 3:58 下午
 *
 * @since 02.12.10
 */
public class AnnotationConfigUtils {

    public static final String CONFIGURATION_ANNOTATION_PROCESSOR_BEAN_NAME =
            "org.springframework.context.annotation.internalConfigurationAnnotationProcessor";

    public static void registerAnnotationConfigProcessors(
            BeanDefinitionRegistry registry) {
        if (!registry.containsBeanDefinition(CONFIGURATION_ANNOTATION_PROCESSOR_BEAN_NAME)) {
            AbstractBeanDefinition def = new AbstractBeanDefinition(ConfigurationClassPostProcessor.class);
            registry.registerBeanDefinition(CONFIGURATION_ANNOTATION_PROCESSOR_BEAN_NAME, def);
        }
    }

}
